/* Copyright 2009
 *
 * This program and the accompanying materials
 * are made available under the terms of the
 * Eclipse Public License v1.0 which accompanies
 * this distribution, and is available at
 *
 * 		http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in
 * writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
 * OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * Contributors:
 * 	   IBM Corporation - initial API and implementation for JDT/DLTK
 *     Sean W. Quinn - initial adoption for use with PHP from various sources.
 */
package org.eclipse.php.core;

import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IPath;

/**
 * A Phar entry corresponding to a non-Java resource in an archive
 * {@link INamespaceFragment} or {@link INamespaceFragmentRoot}.
 * <p>
 * One can navigate the non-Java resource tree using the {@link #getChildren()}
 * and {@link #getParent()} methods. Phar entry resources are either files (
 * {@link #isFile()} returns true) or directories ({@link #isFile()} returns
 * false). Files don't have any children and the returned array is always empty.
 * </p>
 * <p>
 * Phar entry resources that refer to the same element are guaranteed to be
 * equal, but not necessarily identical.
 * <p>
 *
 * @see org.eclipse.jdt.core.IJarEntryResource
 */
public interface IPharEntryResource extends IStorage {

	/**
	 * Returns the list of children of this Phar entry resource. Returns an
	 * empty array if this Phar entry is a file, or if this Phar entry is a
	 * directory and it has no children.
	 *
	 * @return the children of this Phar entry resource
	 */
	IPharEntryResource[] getChildren();

	/**
	 * Returns the full, absolute path of this Phar entry resource relative to
	 * the archive this Phar entry belongs to.
	 * <p>
	 * A Phar entry resource's full path indicates the route from the root of
	 * the archive to the Phar entry resource. Within an archive, there is
	 * exactly one such path for any given Phar entry resource.
	 * </p>
	 * <p>
	 * The returned path is absolute (i.e. it starts with a separator) and it
	 * never has a trailing separator.
	 * </p>
	 *
	 * @return the absolute path of this Phar entry resource
	 */
	IPath getFullPath();

	/**
	 * Returns the parent of this Phar entry resource. This is either an
	 * {@link IPharEntryResource}, an {@link INamespaceFragment} or an
	 * {@link INamespaceFragmentRoot}.
	 *
	 * @return the parent of this Phar entry resource
	 */
	Object getParent();

	/**
	 * Returns the package fragment root this Phar entry resource belongs to.
	 *
	 * @return the package fragment root this Phar entry resource belongs to.
	 */
	INamespaceFragmentRoot getNamespaceFragmentRoot();

	/**
	 * Returns <code>true</code> if this Phar entry represents a file. Returns
	 * <code>false</code> if it is a directory.
	 *
	 * @return whether this Phar entry is a file
	 */
	boolean isFile();

}
